Skip to content

Conversation

@Skipants
Copy link

@Skipants Skipants commented Nov 9, 2023

By flattening the loop and only doing YARD parsing once per different list of paths (model vs. controller) we see a significant speedup.

Here's the stats

Before fix:
   bundle exec rails swagger_yard:generate --trace  190.84s user 2.28s system 99% cpu 3:14.88 total
➜ monolith-app ✔ wc artifacts/openapi.json
   10810   23440  317305 artifacts/openapi.json

After fix:
bundle exec rails swagger_yard:generate --trace  6.68s user 1.33s system 92% cpu 8.637 total
➜ monolith-app ✔ wc artifacts/openapi.json
   10810   23440  317305 artifacts/openapi.json

swagger_yard:generate is our rake task that builds the spec and outputs the openapi file to artifacts/openapi.json.
I use wc artifacts/openapi.json to test that the generation is the same.

By flattening the loop and only doing YARD parsing once per different list of paths (model vs. controller) we see a significant speedup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant